package com.chushouya.order.constants;


import com.general.framework.core.enums.IEnum;
import com.general.framework.core.lang.Strings;

import java.util.Objects;

public enum TradeTypeEnum implements IEnum<Integer> {

    //预付款
    PREPAY(1, "预付款"),
    // 余款
    BALANCE(2, "余款"),
    DEDUCTION(4, "扣款"),
    SETTLE(5, "结算"),
    ;


    private Integer value;

    private String desc;

    TradeTypeEnum(Integer value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    public static String getDesc(Integer status) {
        for (TradeTypeEnum thisEnum : TradeTypeEnum.values()) {
            if (Objects.equals(thisEnum.value, status)) {
                return thisEnum.desc;
            }
        }
        return Strings.EMPTY;
    }

    @Override
    public Integer value() {
        return this.value;
    }

    @Override
    public String named() {
        return this.desc;
    }
}
